package cn.org.eshow.webapp.action.response;

import cn.org.eshow.model.ProductCategory;
import cn.org.eshow.util.StringUtil;

import java.util.Date;
import java.util.List;

/**
 * 药品分类返回对象
 */
public class ProductCategoryResponse {

    private Integer id = 0;// ID

    private Date addTime;//add_time

    private Date updateTime;//update_time

    private Integer level;//层级（1一级，2二级，以此类推）

    private String no;//编号

    private String name;//名称

    private String description;//描述

    private String img;//图标

    private Integer childrenSize;//底层目录的数量

    private Integer sequence;//排序

    private List<ProductCategoryResponse> childProductCategories;//子分类 后期赋值

    public ProductCategoryResponse() {
    }

    public ProductCategoryResponse(ProductCategory productCategory) {
        this.id = productCategory.getId();

        this.addTime = productCategory.getAddTime();

        this.updateTime = productCategory.getUpdateTime();

        this.level = productCategory.getLevel() == null ? 0 : productCategory.getLevel();

        this.no = productCategory.getNo() == null ? "" : productCategory.getNo();

        this.name = productCategory.getName() == null ? "" : productCategory.getName();

        this.description = productCategory.getDescription() == null ? "" : productCategory.getDescription();

        this.img = productCategory.getImg() == null ? "" : productCategory.getImg();

        this.childrenSize = productCategory.getChildrenSize() == null ? 0 : productCategory.getChildrenSize();

        this.sequence = productCategory.getSequence() == null ? 0 : productCategory.getSequence();

    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return StringUtil.empty(name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return StringUtil.empty(description);
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public Integer getChildrenSize() {
        return childrenSize;
    }

    public void setChildrenSize(Integer childrenSize) {
        this.childrenSize = childrenSize;
    }

    public Integer getSequence() {
        return sequence;
    }

    public void setSequence(Integer sequence) {
        this.sequence = sequence;
    }

    public List<ProductCategoryResponse> getChildProductCategories() {
        return childProductCategories;
    }

    public void setChildProductCategories(List<ProductCategoryResponse> childProductCategories) {
        this.childProductCategories = childProductCategories;
    }
}